package com.frostmourne.loreoriginex.objects.loreorigins;

import com.frostmourne.loreoriginex.objects.LoreOrigin;
import com.frostmourne.loreoriginex.objects.LoreOriginData;
import com.frostmourne.loreoriginex.objects.managers.PlayerDataManager;
import org.bukkit.entity.LivingEntity;

import java.util.List;

public class LoreOriginHealth{

    public final static String key = "Health";

    public void execute(LivingEntity livingEntity){
        if (PlayerDataManager.getDataMap().containsKey(livingEntity.getUniqueId())) {
            LoreOriginData data =
                    PlayerDataManager.getDataMap()
                            .get(livingEntity.getUniqueId()).getLoreOriginDataByKeyName(key);
            if (data == null){
                return;
            }
            double maxHealth = data.getValues().get(0);
            livingEntity.setMaxHealth(maxHealth);
        }

    }
}
